﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using EPS.Business;

namespace EPS.Host
{
    class Program
    {
        static void Main(string[] args)
        {
            // 启动服务

            ServiceHost UserInfoHost = new ServiceHost(typeof(UserInfoService));
            ServiceHost ProjectHost = new ServiceHost(typeof(ProjectService));
            ServiceHost ZoneHost = new ServiceHost(typeof(ZoneService));
            ServiceHost TemplateHost = new ServiceHost(typeof(TemplateService));
            try
            {
                UserInfoHost.Open();
                ProjectHost.Open();
                ZoneHost.Open();
                TemplateHost.Open();
                Console.WriteLine("服务已启动，按任意键关闭……");
                Console.Read();
            }
            finally
            {
                if (UserInfoHost.State != CommunicationState.Closed) UserInfoHost.Close();
                if (ProjectHost.State != CommunicationState.Closed) ProjectHost.Close();
                if (ZoneHost.State != CommunicationState.Closed) ZoneHost.Close();
                if (TemplateHost.State != CommunicationState.Closed) TemplateHost.Close();
            }

        }
    }
}
